package cn.tedu.mall.front.controller;

import cn.tedu.mall.common.restful.JsonResult;
import cn.tedu.mall.front.service.IFrontSpuDetailService;
import cn.tedu.mall.pojo.product.vo.SpuDetailStandardVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class FrontSpuDetailController {

    @Autowired
    private IFrontSpuDetailService spuDetailService;

    /**
     * 根据spuId查询 spuDetail详情
     */
    @GetMapping("/front/spu/detail/{spuId}")
    public JsonResult<SpuDetailStandardVO> getSpuDetailBySpuId(
            @PathVariable("spuId") Long spuId){
        SpuDetailStandardVO spuDetailStandardVO = spuDetailService.getSpuDetail(spuId);
        return JsonResult.ok(spuDetailStandardVO);
    }

}
